import axios from 'axios'
axios.defaults.baseURL = 'http://192.168.0.109:30500/mail';
// const $http=axios.create({
//   baseURL : 'http://192.168.0.101:30500/mail'
// });
axios.interceptors.response.use(resp=> {
  if(resp.status===200&&resp.statusText==='OK'){
    return resp.data;
  }
}, (error) =>{
  return Promise.reject(error);
});
const $http={
  toGet:url=> axios.get(url),
  toPost:(url,data)=>axios.post(url,data),
  toPut:(url,data)=>axios.put(url,data),
  toDel:url=>axios.delete(url)
};
// $http.toGet=url=>axios.get(url);
// $http.toPost=(url,data)=>axios.post(url,data);
// $http.toPut=(url,data)=>axios.put(url,data);
// $http.toDel=url=>axios.delete(url);

export default $http;


